﻿<UserControl x:Class="SimpleEditor.Person.PersonView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Width="400">
    <Grid Margin="20">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <UniformGrid Columns="2">
            <Label Content="First Name" VerticalAlignment="Top" />
            <TextBox Text="{VBinding Path=FirstName}" VerticalAlignment="Top" IsEnabled="{Binding Path=IsEditing}"/>
            <Label Content="Last Name" VerticalAlignment="Top" />
            <TextBox Text="{VBinding Path=LastName}" VerticalAlignment="Top" IsEnabled="{Binding Path=IsEditing}"/>

            <Label Content="Full Name" VerticalAlignment="Top" />
            <!-- Bound to fullname on the ViewModel as an example -->
            <Label Content="{Binding Path=FullName}" VerticalAlignment="Top"/>
        </UniformGrid>
        
        <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
            <StackPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="MinWidth" Value="60" />
                </Style>
            </StackPanel.Resources>
            <Button Content="Edit" Command="{Binding Path=BeginEditCommand}" />
            <Button Content="Undo" Command="{Binding Path=CancelEditCommand}" Margin="5,0,0,0"/>
            <Button Content="Save" Command="{Binding Path=EndEditCommand}" Margin="5,0"/>
            <Button Content="Close" Command="{Binding Path=CloseCommand}" />
        </StackPanel>
    </Grid>
</UserControl>
